home *** CD-ROM | disk | FTP | other *** search
/ Super PC 34 / Super PC 34 (Shareware).iso / spc / UTIL / DJGPP2 / V2 / DJTST200.ZIP / tests / libc / ansi / stdio / append.c next >
Encoding:
C/C++ Source or Header  |  1995-08-27  |  459 b   |  29 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/stat.h>
  4.  
  5. int
  6. main(void)
  7. {
  8.   FILE *f;
  9.   struct stat s;
  10.   size_t len;
  11.  
  12.   f = fopen("append.dat", "w");
  13.   fprintf(f, "hello, there\n");
  14.   fclose(f);
  15.   stat("append.dat", &s);
  16.   len = s.st_size;
  17.  
  18.   f = fopen("append.dat", "a");
  19.   fprintf(f, "hello, there\n");
  20.   fclose(f);
  21.   stat("append.dat", &s);
  22.   if (s.st_size != len * 2)
  23.   {
  24.     printf("wrong size!\n");
  25.   }
  26.  
  27.   return 0;
  28. }
  29.